const Koa = require('koa');
const app = new Koa()
const cors = require('@koa/cors')
const { bodyParser } = require("@koa/bodyparser");
const useRouters = require('./router/index.js')


// 解决跨域
app.use(cors())

// 引入bodyparser中间件，用来处理post请求的body
app.use(bodyParser())

useRouters(app)


app.listen(3000, () => {
    console.log('Server is running at http://localhost:3000')
})